﻿using OZDoo.Core.Providers;

namespace OZDoo.Data
{
    /// <summary>
    /// 数据提供者的抽象类,所有数据提供者必须继承该类
    /// </summary>
    public abstract class DataProvider : System.Configuration.Provider.ProviderBase
    {
        /// <summary>
        /// 默认的数据提供者配置节名称
        /// </summary>
        private static string DataProviderSectionName = "DataProviders";
        /// <summary>
        /// 初始化一个提供者
        /// </summary>
        /// <typeparam name="T">提供者类型</typeparam>
        /// <param name="providername">提供者名称</param>
        /// <returns>提供者类型实例</returns>
        protected static T Instance<T>(string providername) where T : DataProvider
        {
            return ProviderManage.getProvider<T>(DataProviderSectionName, providername);
        }
    }
}
